package com.kim.smartring.activity;

import com.kim.smartring.db.model.User;
import com.kim.smartring.net.business.RegisterBusiness;
import com.kim.smartring.net.business.RegisterBusiness.RegisterCallback;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class RegisterActivity extends BaseActivity implements OnClickListener {

	private static final int MSG_REGISTER_SUCCESS = 0x10011;
	private static final int MSG_REGISTER_FAIL = 0x10012;

	private String account;
	private String password;

	private EditText edtAccount;
	private EditText edtPassword;
	private EditText edtPasswordConform;

	private Button btnRegister;
	private Button btnCancel;

	private Handler registerHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {
			switch (msg.what) {
			case MSG_REGISTER_SUCCESS:
				break;
			case MSG_REGISTER_FAIL:
				break;
			}
			super.handleMessage(msg);
		}

	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	private void initView() {
		btnRegister.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {

		}
	}

	private void doRegister() {
		User user = new User();
		RegisterBusiness.register(this, user, new RegisterCallback() {

			@Override
			public void registerSuccess() {
				registerHandler.sendEmptyMessage(MSG_REGISTER_SUCCESS);
			}

			@Override
			public void registerFail() {
				registerHandler.sendEmptyMessage(MSG_REGISTER_FAIL);
			}
		});
	}

}
